package cn.doitedu;

import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.BytesWritable;
import org.roaringbitmap.RoaringBitmap;

public class Bitmap32CountActiveDays extends UDF {

    public int evaluate(BytesWritable bmBytes,int startDiff, int endDiff){

        // 反序列化传入的bitmap
        RoaringBitmap bitmap = Bitmap32SerDeUtil.deSerBitmap(bmBytes.getBytes());

        return (int)bitmap.rangeCardinality(startDiff,endDiff);

    }



}
